import { createRouter, createWebHistory } from 'vue-router';



const routes = [
    {
        path: "/",
        name: 'login',
        component: () => import("../views/Login.vue"),
    },
    {
        path: "/dingtalkcallback",
        name: 'DingTalk',
        component: () => import("../views/DingTalk.vue"),
    },
    {
        path: "/ui",
        name: 'ui',
        component: () => import("../views/UploadImage.vue"),
    },
    {
        path: "/face",
        name: 'face',
        component: () => import("../views/Face.vue"),
    },
    {
        path: "/home",
        name: 'home',
        component: () => import("../views/Home.vue"),
    },
    {
        path: "/web",
        name: 'web',
        component: () => import("../views/Webs.vue"),
    },
    {
        path: "/tr",
        name: 'tr',
        component: () => import("../views/TalkRoom.vue"),
    },
    {
        path: "/re",
        name: 're',
        component: () => import("../views/ReRoom.vue"),
    },
    {
        path: "/goods",
        name: 'goods',
        component: () => import("../views/goods.vue"),
    },
    {
        path: "/buy",
        name: 'buy',
        component: () => import("../views/buy.vue"),
    },
    {
        path: "/cart",
        name: 'cart',
        component: () => import("../views/cart.vue"),
    },
    {
        path: "/order",
        name: 'order',
        component: () => import("../views/order.vue"),
    },
    {
        path: "/pay",
        name: 'pay',
        component: () => import("../views/pay.vue"),
    },
    {
        path: "/payback",
        name: 'payback',
        component: () => import("../views/payback.vue"),
    },
    {
        path: "/rate",
        name: 'rate',
        component: () => import("../views/rate.vue"),
    },
    {
        path: "/ttest",
        name: 'ttest',
        component: () => import("../views/ttest.vue"),
    },




];




const router = createRouter({
  // history: createWebHistory(process.env.BASE_URL),
  history: createWebHistory(),
  routes
});



// router.beforeEach((to, from, next) => {
//   var reslist = ['/login','/']
//   if (reslist.indexOf(to.path) == -1) {
//       var token = localStorage.getItem('token')
//       if (token) {
//           //验证是否在权限列表中
//           var menulist = JSON.parse(localStorage.getItem('page_list'))
//           if (menulist) {
//               var mlist = menulist
//               if (mlist.indexOf(to.path) >= 0) {
//                   next()
//               } else {
//                   alert("无权访问此页面")
//                   next({ "name": 'login' })
//               }
//           } else {
//               alert("无权访问")
//           }

//       } else {
//           next({ "name": 'login' })
//       }
//   }else {
//       next()
//   }
// })



export default router;